package com.ruoyi.parking.mapper;

import java.util.Date;
import java.util.List;
import com.ruoyi.parking.domain.ParkingAppointment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 停车预约Mapper接口
 * 
 * @author ruoyi
 * @date 2025-09-24
 */
@Mapper
public interface ParkingAppointmentMapper 
{
    /**
     * 查询停车预约
     * 
     * @param id 停车预约主键
     * @return 停车预约
     */
    public ParkingAppointment selectParkingAppointmentById(Long id);

    /**
     * 查询停车预约列表
     * 
     * @param parkingAppointment 停车预约
     * @return 停车预约集合
     */
    public List<ParkingAppointment> selectParkingAppointmentList(ParkingAppointment parkingAppointment);

    /**
     * 检查车位预约冲突
     * 
     * @param spaceId 车位ID
     * @param appointTime 预约时间
     * @param excludeId 排除的预约ID
     * @return 冲突数量
     */
    public int checkAppointmentConflict(@Param("spaceId") Long spaceId, @Param("appointTime") Date appointTime, @Param("excludeId") Long excludeId);

    /**
     * 查询过期预约列表
     * 
     * @param currentTime 当前时间
     * @return 预约列表
     */
    public List<ParkingAppointment> selectExpiredAppointments(@Param("currentTime") Date currentTime);

    /**
     * 新增停车预约
     * 
     * @param parkingAppointment 停车预约
     * @return 结果
     */
    public int insertParkingAppointment(ParkingAppointment parkingAppointment);

    /**
     * 修改停车预约
     * 
     * @param parkingAppointment 停车预约
     * @return 结果
     */
    public int updateParkingAppointment(ParkingAppointment parkingAppointment);

    /**
     * 删除停车预约
     * 
     * @param id 停车预约主键
     * @return 结果
     */
    public int deleteParkingAppointmentById(Long id);

    /**
     * 批量删除停车预约
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteParkingAppointmentByIds(Long[] ids);
}
